package com.jyniubi.gmall.cart.config;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class ThreadPoolConfig {

   /* @Bean
    public ExecutorService executorService(
            @Value("${threadPool.corePoolSize}") Integer corePoolSize,
            @Value("${threadPool.maximumPoolSize}") Integer maximumPoolSize,
            @Value("${threadPool.keepAliveTime}") Integer keepAliveTime,
            @Value("${threadPool.blockingQueueSize}") Integer blockingQueueSize
    ){
        ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("cart-thread-pool-%d").build();

        return new ThreadPoolExecutor(corePoolSize,maximumPoolSize, keepAliveTime,TimeUnit.MINUTES,new ArrayBlockingQueue<>(blockingQueueSize),threadFactory);
    }*/
}
